import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'


// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
  ],
  build: {
    chunkSizeWarningLimit: 1000000, // 单位 KB
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  server: {
    port: 5076,
    proxy:{
      '/api': {//获取请求中包含了/api的请求
        target: 'http://localhost:9003',
        changeOrigin: true,//修改源
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
})
